#include <iostream>
#include <thread>
#include <functional>

using std::cout;
using std::endl;
using std::thread;
using std::function;

int main(int argc, char *argv[])
{
    cout << "main thread id = " 
        << std::this_thread::get_id() << endl;

    function<void(int)> f = [](int x){
        cout << "child thread x = " << x << endl;
        cout << "child thread id = " 
             << std::this_thread::get_id() << endl;
    };

    thread th(f, 6);

    th.join();//主线程main等待子线程的执行

    return 0;
}

